package handler;

public class ThrowExceptionDemo {

    public static void main(String[] args) {
        try {
            System.out.println("程序开始..");
            for (int i = 0; i < 10; i++) {
                if (i % 3 == 0) {
                    throw new Exception("自己抛出的异常");
                }
            }
            System.out.println("程序即将结束...");
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            System.out.println("程序执行完毕!");
        }
    }
}
